/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.wiai.untl.core.dao.jpa;

import com.wiai.untl.core.dao.RuangDAO;
import com.wiai.untl.core.entity.Gedung;
import com.wiai.untl.core.entity.Ruang;
import com.wiai.untl.core.entity.StatusRuang;
import java.util.List;

/**
 *
 * @author Hendro Steven
 */
public class RuangDAOImpl extends GeneralDAOImpl implements RuangDAO {

    @Override
    public List<Ruang> getAllRuang() {
        return getJpaTemplate().find("Select r From Ruang r");
    }

    @Override
    public List<Ruang> getByGedung(Gedung gedung) {
        return getJpaTemplate().find("Select r From Ruang r Where r.gedung=?1",gedung);
    }

    @Override
    public List<Ruang> getByMinKapasitas(int kapasitas) {
        return getJpaTemplate().find("Select r From Ruang r Where r.kapasitas>=?1",kapasitas);
    }

    @Override
    public List<Ruang> getByStatus(StatusRuang status) {
        return getJpaTemplate().find("Select r From Ruang r Where r.statusRuang=?1",status);
    }

    @Override
    public Ruang getById(long id) {
        return (Ruang)getJpaTemplate().find(Ruang.class, id);
    }
    
}
